package com.noassertions.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Transient;

import org.hibernate.annotations.Parameter;

//TODO: actually implement serializable
@Entity
public class Rider implements Serializable
{
	// Hack to get around JPA not allowing one to one relationships
	// on a primary key.
	@Id
	@GeneratedValue(generator = "customForeignGenerator")
	@org.hibernate.annotations.GenericGenerator(
			name = "customForeignGenerator",
			strategy = "foreign",
			parameters = @Parameter(name = "property", value = "user")
	)

	private int userid; 

	@OneToOne(mappedBy="rider")
	public User user;
	
	@Column(nullable=false)
	private float totalbodyheight; 
	@Column(nullable=false)
	private float sternalnotch; 
	@Column(nullable=false)
	private float trunk; 
	@Column(nullable=false)
	private float humerus; 
	@Column(nullable=false)
	private float forearm; 
	@Column(nullable=false)
	private float totalarm; 
	@Column(nullable=false)
	private float femur; 
	@Column(nullable=false)
	private float tibia; 
	@Column(nullable=false)
	private float inseam; 
	@Column(nullable=false)
	private float footlength;
	@Column(nullable=false)
	private float shoulderwidth;
	@Column(nullable=true)
	private String notes; 
	
	// Convenience vars
	@Transient
	private String firstname;
	@Transient
	private String lastname;
	@Transient
	private Date birthdate;
	
	public void setUserid(int userid) {
		this.userid = userid;
	}
	public int getUserid() {
		return userid;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public float getTotalbodyheight() {
		return totalbodyheight;
	}
	public void setTotalbodyheight(float totalbodyheight) {
		this.totalbodyheight = totalbodyheight;
	}
	public float getSternalnotch() {
		return sternalnotch;
	}
	public void setSternalnotch(float sternalnotch) {
		this.sternalnotch = sternalnotch;
	}
	public float getTrunk() {
		return trunk;
	}
	public void setTrunk(float trunk) {
		this.trunk = trunk;
	}
	public float getHumerus() {
		return humerus;
	}
	public void setHumerus(float humerus) {
		this.humerus = humerus;
	}
	public float getForearm() {
		return forearm;
	}
	public void setForearm(float forearm) {
		this.forearm = forearm;
	}
	public float getTotalarm() {
		return totalarm;
	}
	public void setTotalarm(float totalarm) {
		this.totalarm = totalarm;
	}
	public float getFemur() {
		return femur;
	}
	public void setFemur(float femur) {
		this.femur = femur;
	}
	public float getTibia() {
		return tibia;
	}
	public void setTibia(float tibia) {
		this.tibia = tibia;
	}
	public float getInseam() {
		return inseam;
	}
	public void setInseam(float inseam) {
		this.inseam = inseam;
	}
	public float getFootlength() {
		return footlength;
	}
	public void setFootlength(float footlength) {
		this.footlength = footlength;
	}
	public void setNotes(String notes) {
		this.notes = notes;
	}
	public String getNotes() {
		return notes;
	}
	public void setShoulderwidth(float shoulderwidth) {
		this.shoulderwidth = shoulderwidth;
	}
	public float getShoulderwidth() {
		return shoulderwidth;
	}
	public String getFirstname() {
		return firstname;
	}
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}
	public String getLastname() {
		return lastname;
	}
	public void setLastname(String lastname) {
		this.lastname = lastname;
	}
	public Date getBirthdate() {
		return birthdate;
	}
	public void setBirthdate(Date birthdate) {
		this.birthdate = birthdate;
	}
}